package de.fmannan.addbook.domainmodel;

import java.io.IOException;

import org.eclipse.core.runtime.IAdaptable;

import de.fmannan.addbook.persistence.xmlwriter.XMLWriter;

/**
 * @author fmannan
 * 
 * All classes implementing IContact have to provide their name and their
 * parent item.
 * 
 */
public interface IContact extends IAdaptable {
	

	/**
	 * Returns the parent-element of a tree element. This method has to be
	 * implemented by each member of the object domain model such as contacts or
	 * groups.
	 */	
	public Object getParent();
	
	public void setParent(IContact parent);
	
	/**
	 * Retrieves an object array which contains all children of the given parent
	 * element. This method has to be implemented by each member of the object
	 * domain model such as contacts or groups.
	 */	
	public Object[] getChildren();
	
	/**
	 * This method has to be implemented by each member of the object domain
	 * model such as contacts or groups.
	 * 
	 * @return true if the given parent has children, false otherwise
	 */
	public boolean hasChildren();
	    
	/**
	 * Builds an XML representation of this object. 
	 */
	public void writeToXML(XMLWriter xml) throws IOException;
}
